package cn.com.api.mapper.base;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.apache.ibatis.annotations.*;

import com.sdicons.json.validator.impl.predicates.True;

import cn.com.api.entity.ApiU_coupon;

//DAO
public interface U_couponMapperBase {

	// 根据id查看
	@Select("SELECT * FROM U_COUPON  WHERE COUPON_ID = #{coupon_id}")
	public ApiU_coupon findU_couponById(Integer coupon_id);

	// 查看数据集
	@Select("SELECT * FROM U_coupon")
	public List<ApiU_coupon> findU_coupons();

	// 根据条件查看数据集
	public List<Map<String, Object>> findU_couponsByMap(HashMap condition);

	// 添加
	@Insert("INSERT INTO U_COUPON (COUPON_CATE_ID, CORP_NAME, CORP_ADRESS, RANGE, CORP_MOBILE, BUSINESS_HOURS, COUPON_TYPE, DESCRIPTION, CORP_IMG, CORP_LONGITUDE, CORP_LATITUDE, DEPOSIT_AMOUNT, DEPOSIT_STATUS, SORT, COUPON_AMOUT, USE_LIMIT1, COUPON_COUNT, START_TIME, END_TIME, EXT1, EXT2, EXT3, EXT4, EXT5, CREATE_TIME, USER_ID, IS_ACTIVE, PROVINCE, CITY, AREA, COUPON_SCORE, COUPON_PREFIX, USE_LIMIT2, USE_LIMIT3, USE_LIMIT4, COUPON_IMG) VALUES (#{coupon_cate_id}, #{corp_name}, #{corp_adress}, #{range}, #{corp_mobile}, #{business_hours}, #{coupon_type}, #{description}, #{corp_img}, #{corp_longitude}, #{corp_latitude}, #{deposit_amount}, #{deposit_status}, #{sort}, #{coupon_amout}, #{use_limit1}, #{coupon_count}, #{start_time}, #{end_time}, #{ext1}, #{ext2}, #{ext3}, #{ext4}, #{ext5}, #{create_time}, #{user_id}, #{is_active}, #{province}, #{city}, #{area}, #{coupon_score}, #{coupon_prefix}, #{use_limit2}, #{use_limit3}, #{use_limit4}, #{coupon_img})")
	@Options(useGeneratedKeys = true, keyProperty = "coupon_id")
	public int insertU_coupon(ApiU_coupon u_coupon);

	// 修改
	@Update("UPDATE U_COUPON SET COUPON_CATE_ID = #{coupon_cate_id}, CORP_NAME = #{corp_name}, CORP_ADRESS = #{corp_adress}, RANGE = #{range}, CORP_MOBILE = #{corp_mobile}, BUSINESS_HOURS = #{business_hours}, COUPON_TYPE = #{coupon_type}, DESCRIPTION = #{description}, CORP_IMG = #{corp_img}, CORP_LONGITUDE = #{corp_longitude}, CORP_LATITUDE = #{corp_latitude}, DEPOSIT_AMOUNT = #{deposit_amount}, DEPOSIT_STATUS = #{deposit_status}, SORT = #{sort}, COUPON_AMOUT = #{coupon_amout}, USE_LIMIT1 = #{use_limit1}, COUPON_COUNT = #{coupon_count}, START_TIME = #{start_time}, END_TIME = #{end_time}, EXT1 = #{ext1}, EXT2 = #{ext2}, EXT3 = #{ext3}, EXT4 = #{ext4}, EXT5 = #{ext5}, CREATE_TIME = #{create_time}, USER_ID = #{user_id}, IS_ACTIVE = #{is_active}, PROVINCE = #{province}, CITY = #{city}, AREA = #{area}, COUPON_SCORE = #{coupon_score}, COUPON_PREFIX = #{coupon_prefix}, USE_LIMIT2 = #{use_limit2}, USE_LIMIT3 = #{use_limit3}, USE_LIMIT4 = #{use_limit4}, COUPON_IMG = #{coupon_img} WHERE COUPON_ID = #{coupon_id}")
	public int updateU_coupon(ApiU_coupon u_coupon);

	// 删除
	@Delete("DELETE FROM U_COUPON  WHERE COUPON_ID = #{coupon_id}")
	public int deleteU_coupon(Integer coupon_id);

	// Foreign keys revelant

	// region Indexs revelant

}
